package cn.tedu.oop;
/**本类用于构造函数的巩固练习*/
public class TestCat {
    public static void main(String[] args) {
        Cat c1 = new Cat();//无参构造,使用默认构造
        Cat c2 = new Cat("");
        Cat c3 = new Cat("小明",0,0);
        System.out.println(c1.name);//null
        System.out.println(c2.price);//0.0
        System.out.println(c3.name);//小明

    }
}
class Cat{
    String name;
    int age;
    double price;
    public void play(){
        System.out.println("正在扑蝴蝶~");
    }
    public Cat(){
        System.out.println("我是Cat的无参构造");
    }
    public Cat (String s){
        System.out.println("我是Cat的含参构造"+s);
    }

    public Cat(String name, int age, double price) {
        this.name = name;
        this.age = age;
        this.price = price;
        System.out.println("我是Cat的全参构造");
    }
}
